package homework.api.day08;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.Scanner;

public class PWDemo {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream("pwNote.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);

        Scanner scan = new Scanner(System.in);
        System.out.println("记事本已启动，单独输入exit退出：");
        while(true){
            String line = scan.nextLine();
            if("exit".equalsIgnoreCase(line.trim())){
                System.out.println("正在退出");
                break;
            }
            pw.println(line);
        }
        pw.close();
    }
}
